# coding:utf-8

# food = input('你想吃什么呢:')
# print(food)

# class Test(object):
#     a = 1
#     b = 2
#
#     def __init__(self):
#         self.a = self.a
#         self.b = self.b
#
# test = Test()
# print(test.a)
# result = vars(test)
# print(result)
#
# print(hasattr(test,'a'))
# print(hasattr(test,'c'))
# setattr(test,'c',3)
# print(test.c)
# print(vars(test))
#
# if hasattr(list,'appends'):
#     print(getattr(list,'appends'))
# else:
#     print('不存在')
#
# a = ['',None,True,0]
# print(any(a))
# print(all(a))

from functools import reduce

fruts = ['apple','banana','orange']

result = filter(lambda x:'e' in x,fruts)
print(list(result))
print(fruts)

def filter_func(item):
    if 'e' in item:
        return True
filter_result = filter(filter_func,fruts)
print(list(filter_result))

map_result = map(filter_func,fruts)
print(list(map_result))

reduce_result = reduce(lambda x,y: x * y,[1,1,2,4])
print(reduce_result)

reduce_result_str = reduce(lambda x,y: x + y,fruts)
print(reduce_result_str)